<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="keywords" content="">
		<meta name="description" content="">
		<title>聊天</title>
		<script type="text/javascript" src="__PUBLIC__/mobile/js/flexible.js"></script>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/mobile/css/sm.css">
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/mobile/css/lee.css">
		<style>
			/*弹窗标题、确认、取消字体颜色*/
			html body .date-time .bar-nav,
			html body .city-picker .bar-nav,
			html body .meeting-num .bar-nav, 
			html body .date-time .picker-footer span,h
			html body .city-picker .picker-footer span,
			html body .meeting-num .picker-footer span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale .layui-m-layerbtn span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .delay-time .layui-m-layercont header, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .delay-time .layui-m-layercont article span.active i:before, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .delay-time .layui-m-layercont footer, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layerbtn span {
				color: #{$color.layer_font};
			}

			/*按钮边框，原白色*/
			html body .header-user-activity .activity-btn strong, 
			html body .chat-footer div strong, 
			html body .wrap .activity-index .evaluation div span, 
			html body .wrap .activity-evaluation section div span, 
			html body .wrap .invite-index section .check span:before, 
			html body .wrap .playmate-index .playmate-box dl dd.position .focused em, 
			html body .wrap .user-index .detail a dl dd span, 
			html body .wrap .user-detail .pic div .focused i, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-password .layui-m-layercont div span:nth-child(6)
			{

				-webkit-box-shadow: 0 0 0 1px #{$color.main_line} inset;
				-moz-box-shadow: 0 0 0 1px #{$color.main_line} inset;
				-ms-box-shadow: 0 0 0 1px #{$color.main_line} inset;
				-o-box-shadow: 0 0 0 1px #{$color.main_line} inset;
				box-shadow: 0 0 0 1px #{$color.main_line} inset;
			}

			/*按钮边框，原黄色*/
			html body .header-title .btn em, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search .btn span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont span
			{
				-webkit-box-shadow: 0 0 0 1px #{$color.deputy_line} inset;
				-moz-box-shadow: 0 0 0 1px #{$color.deputy_line} inset;
				-ms-box-shadow: 0 0 0 1px #{$color.deputy_line} inset;
				-o-box-shadow: 0 0 0 1px #{$color.deputy_line} inset;
				box-shadow: 0 0 0 1px #{$color.deputy_line} inset;
			}

			/*菜单下分割线边框，原白色*/
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .hongbao-confirm .layui-m-layercont h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-selection .layui-m-layercont h2
			{
				border-bottom: 1px solid #{$color.main_line};
			}

			/*弹窗边框，原白色*/
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-password .layui-m-layercont div span
			{
				-webkit-box-shadow: 1px 0 0 0 #{$color.main_line} inset, 0 1px 0 0 #{$color.main_line} inset, 0 -1px 0 0 #{$color.main_line} inset;
				-moz-box-shadow: 1px 0 0 0 #{$color.main_line} inset, 0 1px 0 0 #{$color.main_line} inset, 0 -1px 0 0 #{$color.main_line} inset;
				-ms-box-shadow: 1px 0 0 0 #{$color.main_line} inset, 0 1px 0 0 #{$color.main_line} inset, 0 -1px 0 0 #{$color.main_line} inset;
				-o-box-shadow: 1px 0 0 0 #{$color.main_line} inset, 0 1px 0 0 #{$color.main_line} inset, 0 -1px 0 0 #{$color.main_line} inset;
				box-shadow: 1px 0 0 0 #{$color.main_line} inset, 0 1px 0 0 #{$color.main_line} inset, 0 -1px 0 0 #{$color.main_line} inset;
			}

			/*地图搜索弹窗边框，原白色*/
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .con div:nth-child(1) {
					-webkit-box-shadow: 0 -1px 0 0 #{$color.main_line}, 0 -1px 0 0 #{$color.main_line} inset;
					-moz-box-shadow: 0 -1px 0 0 #{$color.main_line}, 0 -1px 0 0 #{$color.main_line} inset;
					-ms-box-shadow: 0 -1px 0 0 #{$color.main_line}, 0 -1px 0 0 #{$color.main_line} inset;
					-o-box-shadow: 0 -1px 0 0 #{$color.main_line}, 0 -1px 0 0 #{$color.main_line} inset;
					box-shadow: 0 -1px 0 0 #{$color.main_line}, 0 -1px 0 0 #{$color.main_line} inset;
			}

			/*主字体、图标颜色（原白色字体、图标）*/
			html body .header-back-btn:after, 
			html body .header-title .arrow:after,
			html body .header-title .link-arrow:after,
			html body .header-title .arrow-no-event:after, 
			html body .header-title .left-btn, 
			html body .header-title .map:after, 
			html body .header-title .search:after, 
			html body .header-title .help:after, 
			html body .header-title h1, 
			html body .header-title strong, 
			html body .header-title .list:after, 
			html body .header-title .like:after, 
			html body .header-title .like.active:after, 
			html body .header-title .forwarding:after, 
			html body .header-activity .more:before, 
			html body .header-user-activity .arrow:after,
			html body .header-user-activity .link-arrow:after,
			html body .header-user-activity .arrow-no-event:after, 
			html body .header-user-activity .activity-btn strong, 
			html body .header-user-activity em, 
			html body .header-news em:before, 
			html body .header-news em.active i:before, 
			html body .index-footer a, 
			html body .index-footer a:nth-child(1):before, 
			html body .index-footer a:nth-child(2):before, 
			html body .index-footer a:nth-child(3):before, 
			html body .index-footer a:nth-child(4):before, 
			html body .index-footer a:nth-child(5):before, 
			html body .chat-footer div span:after, 
			html body .chat-footer div .active:after, 
			html body .chat-footer div strong, 
			html body .hongbao-footer p, 
			html body .album-footer span:before, 
			html body .header-footer span,
			html body .header-footer label, 
			html body .wrap .activity-chat .chat .msg-box .msg-con h3, 
			html body .wrap .activity-chat .chat .msg-box .msg-con div .con p, 
			html body .wrap .activity-chat .chat .msg-box .msg-con div .con a,
			html body .wrap .activity-chat .chat .msg-box .msg-con .read,  
			html body .date-time .picker-items .picker-items-col,
			html body .city-picker .picker-items .picker-items-col,
			html body .meeting-num .picker-items .picker-items-col, 
			html body .date-time .picker-items .picker-items-col .picker-items-col-wrapper .picker-item,
			html body .city-picker .picker-items .picker-items-col .picker-items-col-wrapper .picker-item,
			html body .meeting-num .picker-items .picker-items-col .picker-items-col-wrapper .picker-item, 
			html body .date-time .picker-items .picker-items-col .picker-items-col-wrapper .picker-selected,
			html body .city-picker .picker-items .picker-items-col .picker-items-col-wrapper .picker-selected,
			html body .meeting-num .picker-items .picker-items-col .picker-items-col-wrapper .picker-selected, 
			html body .calendar .toolbar .toolbar-inner .picker-calendar-month-picker .current-month-value,
			html body .calendar .toolbar .toolbar-inner .picker-calendar-year-picker .current-month-value,
			html body .calendar .toolbar .toolbar-inner .picker-calendar-month-picker .current-year-value,
			html body .calendar .toolbar .toolbar-inner .picker-calendar-year-picker .current-year-value, 
			html body .calendar .picker-modal-inner .picker-calendar-week-days .picker-calendar-week-day, 
			html body .calendar .picker-modal-inner .picker-calendar-months .picker-calendar-months-wrapper .picker-calendar-month .picker-calendar-row .picker-calendar-day, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-layer-msg .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .loading .layui-m-layercont p, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search strong:after, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search div h3, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search div .con span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .hongbao-confirm .layui-m-layercont h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .hongbao-confirm .layui-m-layercont p, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-selection .layui-m-layercont h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-selection .layui-m-layercont .selection span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .change-wx .layui-m-layercont h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .change-wx .layui-m-layercont div span em, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .change-wx .layui-m-layercont strong, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-password .layui-m-layercont div input, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont div,
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont a,
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont p, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont .play:after, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont .stop:after, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont strong, 
			body .lazy-loading, 
			body .no-data, 
			html body .header-title .arrow:after,
			html body .header-title .link-arrow:after,
			html body .header-title .arrow-no-event:after, 
			html body .wrap .activity-list-map #map div div div .BMap_Marker i, 
			html body .picker-columns .picker-items .picker-items-col, 
			html body .picker-columns .picker-items .picker-items-col .picker-items-col-wrapper .picker-item, 
			html body .picker-columns .picker-items .picker-items-col .picker-items-col-wrapper .picker-selected, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-layer-msg .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .input input,
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .input span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .con div span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .con div:before, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search .layui-m-layercont article .con .active:before, 
			html .contact-list .mui-bar-nav .mui-action-back:before,
			html .user-job .mui-bar-nav .mui-action-back:before, 
			html .contact-list .mui-bar-nav .mui-title,
			html .user-job .mui-bar-nav .mui-title, 
			html .contact-list .mui-bar-nav #done.mui-btn,
			html .user-job .mui-bar-nav #done.mui-btn, 
			html .contact-list .mui-indexed-list .mui-indexed-list-search .mui-indexed-list-search-input,
			html .user-job .mui-indexed-list .mui-indexed-list-search .mui-indexed-list-search-input, 
			html .contact-list .mui-indexed-list .mui-indexed-list-search .mui-placeholder .mui-icon-search:before,
			html .user-job .mui-indexed-list .mui-indexed-list-search .mui-placeholder .mui-icon-search:before, 
			html .contact-list .mui-indexed-list .mui-indexed-list-search .mui-placeholder span,
			html .user-job .mui-indexed-list .mui-indexed-list-search .mui-placeholder span, 
			html .contact-list .mui-indexed-list .mui-active:before,
			html .user-job .mui-indexed-list .mui-active:before, 
			html .contact-list .mui-indexed-list .mui-indexed-list-bar a,
			html .user-job .mui-indexed-list .mui-indexed-list-bar a, 
			html .contact-list .mui-indexed-list .mui-indexed-list-inner .mui-indexed-list-empty-alert,
			html .user-job .mui-indexed-list .mui-indexed-list-inner .mui-indexed-list-empty-alert, 
			html .contact-list .mui-indexed-list .mui-indexed-list-inner .mui-table-view .mui-table-view-cell,
			html .user-job .mui-indexed-list .mui-indexed-list-inner .mui-table-view .mui-table-view-cell, 
			html .user-contact .mui-indexed-list .mui-indexed-list-inner .mui-table-view .mui-table-view-cell span:before, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-layer-msg .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale .layui-m-layercont, 
			body .mui-popup .mui-popup-inner div
			{
				color: #{$color.main_font};
			}

			/*副字体、图标颜色（原黄色字体、图标）*/
			html body .header-title h1 span, 
			html body .header-title a.manage, 
			html body .header-user-activity .activity-btn .active, 
			html body .index-footer a:nth-child(1).active,
			html body .index-footer a:nth-child(2).active,
			html body .index-footer a:nth-child(3).active,
			html body .index-footer a:nth-child(4).active,
			html body .index-footer a:nth-child(5).active, 
			html body .index-footer a:nth-child(1).active:before,
			html body .index-footer a:nth-child(2).active:before,
			html body .index-footer a:nth-child(3).active:before,
			html body .index-footer a:nth-child(4).active:before,
			html body .index-footer a:nth-child(5).active:before, 
			html body .hongbao-footer p span, 
			html body .wrap .activity-chat .chat .msg-box .msg-con .unread, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search div .con .active i:before, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search .btn span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .index-search .btn em, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .hongbao .layui-m-layercont .get strong, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-selection .layui-m-layercont .selection span:after, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-selection .layui-m-layercont .selection .active:after, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layer-password .layui-m-layercont h2, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont span:after, 
			body .mui-popup .mui-popup-buttons .mui-popup-button, 
			html body .wrap .activity-map .position-add,
			html body .wrap .invite-map .position-add, 
			html body .wrap .activity-map .position-add p, 
			html body .wrap .invite-map .position-add:before, 
			html body .wrap .invite-map .position-add h2, 
			html body .wrap .invite-map .position-add p 
			{
				color: #{$color.deputy_font};
			}

			/*弹窗背景*/
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .change-wx, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .change-wx .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .layui-m-anim-scale, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .map-search, 
			html body .picker-columns, 
			html body .picker-columns .bar-nav, 
			html body .date-time,
			html body .city-picker,
			html body .meeting-num, 
			html body .date-time .bar-nav,
			html body .city-picker .bar-nav,
			html body .meeting-num .bar-nav, 
			html body .date-time .picker-items,
			html body .city-picker .picker-items,
			html body .meeting-num .picker-items, 
			html body .calendar, 
			html body .calendar .picker-modal-inner .picker-calendar-week-days
			{
				background: #{$color.layer_bac};
			}

			/*个人资料页弹窗按钮*/
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont div,
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont a,
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont span
			{
				background: #{$color.user_setting_btn};
			}

			/*页面背景色*/
			html body, 
			html body .wrap > article
			{
				background: #{$color.page_bac};
			}

			/*头部、底部颜色*/
			html body .header-title, 
			html body .header-user-activity, 
			html body .index-footer, 
			html body .chat-footer, 
			html body .wrap .user-report .selection div, 
			html body .wrap .user-report .other, 

			html body .hongbao-footer, 
			html body .album-footer, 
			html body .header-footer, 
			html .contact-list .mui-bar-nav,
			html .user-job .mui-bar-nav, 
			html body .wrap .activity-map .position-add, 
			html body .wrap .invite-map .position-add
			{
				background: #{$color.header_footer_bac};
			}

			/*内容区颜色*/
			html body .hongbao-footer, 
			html body .album-footer, 
			html body .header-footer, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-setting .layui-m-layercont span, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layercont, 
			body .layui-m-layer .layui-m-layermain .layui-m-layersection .user-record .layui-m-layerbtn, 
			body .mui-popup .mui-popup-inner, 
			body .mui-popup .mui-popup-buttons .mui-popup-button, 
			body .mui-popup .mui-popup-inner, 
			html .contact-list .mui-indexed-list .mui-indexed-list-inner .mui-table-view .mui-table-view-cell,
			html .user-job .mui-indexed-list .mui-indexed-list-inner .mui-table-view .mui-table-view-cell
			 {
				background: #{$color.con_bac};
			}

			html body .header-activity {
			  background: transparent url(../images/activity_header.png) 0 0 no-repeat;
			  -webkit-background-size: 100% 100%;
			  -moz-background-size: 100% 100%;
			  -ms-background-size: 100% 100%;
			  -o-background-size: 100% 100%;
			  background-size: 100% 100%;
			}

			/*聊天收消息颜色*/
			html body .wrap .activity-chat .chat .msg-box .msg-con div .con p {
				background: #{$color.chat_receive_bac};
				color: #{$color.chat_receive_font};

			}

			/*聊天发消息颜色*/
			html body .wrap .activity-chat .chat .msg-box .msg-con .self div p {
				background: #{$color.chat_send_bac};
				color: #{$color.chat_send_font};
			}
		</style>
	</head>
	<body>
		<!--head begin-->
		<header class="header-title">
			<span class="arrow">
			</span>
			<h1>聊天</h1>
		</header>
		<div class="wrap">
			<article class="activity-chat">
				<div class="lazy-loading" v-if="loadingHint == 1">聊天记录加载中~</div>
				<template v-if="loadingHint == 2">
					<div class="lazy-loading">没有数据了~</div>
				</template>
				<section class="chat">
					<div class="msg-box">
						<template v-if="isShow">
							<div class="msg-con" v-for="item in list">
								<h3 v-if="item.add_time" v-text="item.add_time"></h3>
								<div class="" v-bind:class="(item.is_zuoyou == 'wo') ? 'self clearfix' : 'other clearfix'">
									<img src="" alt="" title="" v-bind:src="(item.is_zuoyou == 'wo') ? userSelf.image : userOther.image">
									<div class="con">
										<p v-html="replaceEm(item.content)"></p>
										<a href="" title="" v-if="item.url != 0" v-bind:href="item.url">点击查看</a>
									</div>
									<template v-if="(faId == 0) && (item.is_zuoyou == 'ta')">
										<span v-text="(item.status == 0) ? '未读' : '已读'" v-bind:class="(item.status == 0) ? 'unread' : 'read'"></span>
									</template>
								</div>
							</div>
						</template>
					</div>
				</section>
				<section class="emojis-window">
					<div class="emojis-con clearfix">
						<span v-for="item in emojiArr" v-text="item"></span>
					</div>
				</section>
			</article>
		</div>
		<footer class="chat-footer">
			<div>
				<input type="text" name="" value="" id="">
				<span></span>
				<strong>发送</strong>
			</div>
		</footer>
		<div class="picker-bac"></div>
		<!-- 引入网站js文件 -->
		<script type="text/javascript" src="__PUBLIC__/mobile/js/next.js" charset="UTF-8"></script>
		<!-- 通过PHP获取链接地址 -->
		<script type="text/javascript">
			var tipUrl = "{:U('User/tip')}",
                msgDetailUrl = "{:U('News/message')}",
				msgInfoUrl = "{:U('News/info')}",
                userInfoUrl = "{:U('User/myInfo')}",
                logoutUrl = "{:U('Index/user_login')}",
				emojiLocation = "__PUBLIC__/mobile/images/arclist/",
				userDetailUrl = "{:U('Home/Index/user_detail')}";
		</script>
		<!-- 引入页面.js -->
		<script type="text/javascript" src="__PUBLIC__/mobile/js/pages/activity_chat.js" charset="UTF-8"></script>

		<script type="text/javascript">

RongIMClient.init("{$appkey}");
var msgTime = 0;
var token = "{$rong_id}";
 // 设置连接监听状态 （ status 标识当前连接状态）
 // 连接状态监听器
RongIMClient.setConnectionStatusListener({
	onChanged: function (status) {
		switch (status) {
			//链接成功
			case RongIMLib.ConnectionStatus.CONNECTED:
				console.log('链接成功');
				break;
			//正在链接
			case RongIMLib.ConnectionStatus.CONNECTING:
				console.log('正在链接');
				break;
			//重新链接
			case RongIMLib.ConnectionStatus.DISCONNECTED:
				console.log('断开连接');
				break;
			//其他设备登录
			case RongIMLib.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:
				console.log('其他设备登录');
				break;
			  //网络不可用
			case RongIMLib.ConnectionStatus.NETWORK_UNAVAILABLE:
			  console.log('网络不可用');
			  break;
			}
	}});

 // 消息监听器
 RongIMClient.setOnReceiveMessageListener({
	// 接收到的消息
	onReceived: function (message) {
		// 判断消息类型
		switch(message.messageType){
			case RongIMClient.MessageType.TextMessage:
				   // 发送的消息内容将会被打印
				console.log(message)
				console.log(message.content.content);
				if (message.content.content == '79858') {
					layer.open({
						content: '您的账号在其他设备上登录，如果这不是您的操作，您的密码可能已经泄露，请您修改密码。',
						btn: ['确定'],
						shadeClose: false,
						yes: function () {
							core.href(logoutUrl);
						}
					});
				}
				
				if (message.senderUserId == faId) {
					getMsg(message.content.content, ((message.receivedTime - 300000) > msgTime) ? message.receivedTime : '');
					// 告知服务器已收到消息
					$.ajax({
						url: "{:U('News/NotReadToRead')}",
						type: 'post',
						data: {
							msg_id: message.content.extra
						},
						success: function(data) {
							console.log(data)
						}
					});
					msgTime = message.receivedTime;
				}
				break;
			case RongIMClient.MessageType.VoiceMessage:
				// 对声音进行预加载
				// message.content.content 格式为 AMR 格式的 base64 码
				RongIMLib.RongIMVoice.preLoaded(message.content.content);
				break;
			case RongIMClient.MessageType.ImageMessage:
				// do something...
				break;
			case RongIMClient.MessageType.DiscussionNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.LocationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.RichContentMessage:
				// do something...
				break;
			case RongIMClient.MessageType.DiscussionNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.InformationNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.ContactNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.ProfileNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.CommandNotificationMessage:
				// do something...
				break;
			case RongIMClient.MessageType.CommandMessage:
				// do something...
				break;
			case RongIMClient.MessageType.UnknownMessage:
				// do something...
				break;
			default:
				// 自定义消息
				// do something...
		}
	}
});
// 连接融云服务器。
RongIMClient.connect(token, {
	onSuccess: function(userId) {
	  console.log("Login successfully." + userId);
	  // message();
	},
	onTokenIncorrect: function() {
	  console.log('token无效');
	},
	onError:function(errorCode){
		  var info = '';
		  switch (errorCode) {
			case RongIMLib.ErrorCode.TIMEOUT:
			  info = '超时';
			  break;
			case RongIMLib.ErrorCode.UNKNOWN_ERROR:
			  info = '未知错误';
			  break;
			case RongIMLib.ErrorCode.UNACCEPTABLE_PaROTOCOL_VERSION:
			  info = '不可接受的协议版本';
			  break;
			case RongIMLib.ErrorCode.IDENTIFIER_REJECTED:
			  info = 'appkey不正确';
			  break;
			case RongIMLib.ErrorCode.SERVER_UNAVAILABLE:
			  info = '服务器不可用';
			  break;
		  }
		  console.log(errorCode);
		}
});

function message(id,varl){
	var data = {'shou_id':id,'content':varl};
	var url = "{:U('Home/News/sendMessage')}";
	$.post(url, data, function(result){
		console.log(result)
		console.log("Send successfully");
		// 定义消息类型,文字消息使用 RongIMLib.TextMessage
		var msg = new RongIMLib.TextMessage({content: varl,extra: JSON.parse(result).message_id});
		//或者使用RongIMLib.TextMessage.obtain 方法.具体使用请参见文档
		//var msg = RongIMLib.TextMessage.obtain("hello");
		var conversationtype = RongIMLib.ConversationType.PRIVATE; // 私聊
		var targetId = id; // 目标 Id
		RongIMClient.getInstance().sendMessage(conversationtype, targetId, msg, {
			// 发送消息成功
			onSuccess: function (message) {
				//message 为发送的消息对象并且包含服务器返回的消息唯一Id和发送消息时间戳
				// console.log("Send successfully");
				console.log(message)
				sendMsg(message.content.content, ((message.sentTime - 300000) > msgTime) ? message.sentTime : '');
				msgTime = message.sentTime;
				

			},
			onError: function (errorCode,message) {
				var info = '';
				switch (errorCode) {
					case RongIMLib.ErrorCode.TIMEOUT:
						info = '超时';
						break;
					case RongIMLib.ErrorCode.UNKNOWN_ERROR:
						info = '未知错误';
						break;
					case RongIMLib.ErrorCode.REJECTED_BY_BLACKLIST:
						info = '在黑名单中，无法向对方发送消息';
						break;
					case RongIMLib.ErrorCode.NOT_IN_DISCUSSION:
						info = '不在讨论组中';
						break;
					case RongIMLib.ErrorCode.NOT_IN_GROUP:
						info = '不在群组中';
						break;
					case RongIMLib.ErrorCode.NOT_IN_CHATROOM:
						info = '不在聊天室中';
						break;
					default :
						info = x;
						break;
				}
				core.layerHint('发送失败:' + info);
				console.log('发送失败:' + info);
			}
		});
	},"JSON");
}

		</script>
	</body>
</html>

